<?php
require_once('../../controller/auth.php');
//Start session
 @session_start();
 
 //Include database connection details
 require_once('../inc/config.inc');
 
 
 
 //Connect to mysql server
 $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
 if(!$link) {
  die('Failed to connect to server: ' . mysql_error());
 }
 
 //Select database
 $db = mysql_select_db(DB_DATABASE);
 if(!$db) {
  die("Unable to select database");
 }

 $sn=$_POST['sn2'];
 $sub_moe=$_POST['stm'];
 $est_moe=$_POST['etm'];
 $app_moe=$_POST['moap'];
mysql_query ('SET NAMES utf8');
mysql_query('SET CHARACTER_SET utf8');
$insert=mysql_query("UPDATE main SET submission_moe_date='$sub_moe', est_day_moe='$est_moe',approve_moe_date='$app_moe', status='1' WHERE serial='$sn'") or die ("Error occured : ".mysql_error());
if($insert){
 
 
 ?>
 <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
   <div class="modal-header">
     <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
     <h3 id="myModalLabel">Thank you,</h3>
   </div>
   <div class="modal-body">
     <p class="text-success lead">Your Project has been Updated Successfully!</p>
   </div>
   <div class="modal-footer">
     <button class="btn btn-large btn-warning btn-block" data-dismiss="modal" aria-hidden="true">OK</button>
     
   </div>
 </div>
 
 <?php
 }
 else {
 ?>
 <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
   <div class="modal-header">
     <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
     <h3 id="myModalLabel">OOops!</h3>
   </div>
   <div class="modal-body">
     <p class="text-error lead">Your Project has not been Updated Successfully!</p>
   </div>
   <div class="modal-footer">
     <button class="btn btn-large btn-danger btn-block" data-dismiss="modal" aria-hidden="true">Shut Up!</button>
     
   </div>
 </div>
 <?php
  
  }
  ?>